﻿using ValueOf;

namespace Customers.Api.Domain.Common;

public class DateOfBirth : ValueOf<DateOnly, DateOfBirth>
{
    protected override void Validate()
    {
        if (Value > DateOnly.FromDateTime(DateTime.Now))
        {
            this.ThrowValidationException(nameof(DateOfBirth), "Your date of birth cannot be in the future");
        }
    }
}